

#!/bin/bash

#Nomes dos nos
NomesNos=("node1" "node2" "node3" "node4" "node5" "node6" "node7" "node8" "node9" "node10" "node11" "node12" "node15" "node16" "node17" "node18" "node19" "frontend")

#Servidor Raiz
ssh ${NomesNos[0]} "./root 51702 51703 > saida1.txt &" &
sleep 1

#Servidor de nivel 3
ssh ${NomesNos[1]} "./server node1 51702 51704 51705 > saida2.txt &" &
ssh ${NomesNos[2]} "./server node1 51703 51706 51707 > saida3.txt &" &
sleep 1

#Servidor de nivel 2
ssh ${NomesNos[3]} "./server node2 51704 51708 51709 > saida4.txt &" &
ssh ${NomesNos[4]} "./server node2 51705 51710 51711 > saida5.txt &" &
ssh ${NomesNos[5]} "./server node3 51706 51712 51713 > saida6.txt &" &
ssh ${NomesNos[6]} "./server node3 51707 51714 51715 > saida7.txt &" &
sleep 1

#Clientes
ssh ${NomesNos[7]} "./client node4 51708 > saida8.txt &" &
ssh ${NomesNos[8]} "./client node4 51709 > saida9.txt &" &
ssh ${NomesNos[9]} "./client node5 51710 > saida10.txt &" &
ssh ${NomesNos[10]} "./client node5 51711 > saida11.txt &" &
ssh ${NomesNos[11]} "./client node6 51712 > saida12.txt &" &
ssh ${NomesNos[12]} "./client node6 51713 > saida15.txt &" &
ssh ${NomesNos[13]} "./client node7 51714 > saida16.txt &" &
ssh ${NomesNos[14]} "./client node7 51715 > saida17.txt &" &
sleep 1
